package com.baibei.module;

import com.baibei.basic.BaibeiTinkerApplication;
import com.baibei.ebec.sdk.ApiFactory;
import com.blankj.utilcode.utils.LogUtils;
import com.blankj.utilcode.utils.Utils;
import com.tencent.tinker.loader.shareutil.ShareConstants;
import com.umeng.socialize.Config;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;

import static com.tencent.bugly.beta.tinker.TinkerManager.getApplication;


/**
 * 应用程序
 * Created by ChenRui on 2017/8/2 0002 14:00.
 */
public class EBECBasicApplication extends BaibeiTinkerApplication {

    public EBECBasicApplication() {
        super(ShareConstants.TINKER_ENABLE_ALL, "com.baibei.module.BasicApplicationLike");
    }

    @Override
    public void onCreate() {
        super.onCreate();
        // 初始化接口
        ApiFactory.init(this);
        AppRouter.init(this);


        // 低级初始化线程
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    PlatformConfig.setWeixin(BuildConfig.WECHAT_APP_ID, BuildConfig.WECHAT_APP_SECRET);
                    UMShareAPI.get(getApplication());
                    Config.DEBUG = BuildConfig.DEBUG;
                    Utils.init(getApplicationContext());
                    LogUtils.getBuilder().setLogSwitch(BuildConfig.LOGSWITCH).create();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }).start();


    }
}
